package open.template.work.udm.server.endpoint;


import org.springframework.boot.actuate.endpoint.AbstractEndpoint;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@ConfigurationProperties(prefix = "endpoints.systemTime")
public class MyEndPoint extends AbstractEndpoint<Map<String, Object>> {

    public MyEndPoint() {
        //参数=名字，是否敏感
        super("systemTime", false);
    }


    @Override
    public Map<String, Object> invoke() {
        Map<String, Object> result = new HashMap<String, Object>();
        Date dateTime = new Date();
        result.put("当前时间", dateTime.toString());
        result.put("当前时间戳", dateTime.getTime());
        return result;
    }
}

